package com.wk.springboot.mp;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.meiin.base.core.exception.ApiException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author wang.k
 * @since 2024-12-18
 */
@Service
public class TestUserServiceImpl extends ServiceImpl<TestUserMapper, TestUser> implements ITestUserService {

    @Transactional(rollbackFor = Exception.class,propagation = Propagation.NESTED)
    @Override
    public void insertWithCustom(List<TestUser> list ) {
        for (TestUser testUser : list) {
            this.baseMapper.insert(testUser);
        }
        throw new ApiException("11");
    }
}
